﻿#define  _CRT_SECURE_NO_WARNINGS 1
#include "Snake.h"

void SetPos(int x, int y) {
	HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
	COORD pos = { x,y };
	SetConsoleCursorPosition(hStdout, pos);
}

void PrintWall() {
	//上
	int i = 0;
	for (i = 0; i <= 56; i+=2) {
		wprintf(L"%c", WALL);
	}
	//下
	SetPos(0, 28);
	for (i = 0; i <= 56; i += 2) {
		wprintf(L"%c", WALL);
	}
	//左

	for (i = 1; i <= 27; i++) {
		SetPos(0, i);
		wprintf(L"%c", WALL);
	}
	//右
	for (i = 1; i <= 27; i++) {
		SetPos(56, i);
		wprintf(L"%c", WALL);
	}
	printf("aaa");


}
void GameInit() {
	//设置屏幕大小与标题
	system("mode con cols=100 lines=30");
	system("title 贪吃蛇");

	//设置光标不可见
	HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
	CONSOLE_CURSOR_INFO CursorInfo;
	GetConsoleCursorInfo(hStdout, &CursorInfo);
	//CursorInfo.bVisible = false;
	SetConsoleCursorInfo(hStdout, &CursorInfo);


	//打印界面
	//欢迎来到贪吃蛇小游戏
	SetPos(50, 15);
	printf("欢迎来到贪吃蛇小游戏");
	SetPos(50, 25);
	system("pause");

	system("cls");
	//欢迎来到贪吃蛇小游戏
	SetPos(40, 15);
	printf("用↑.↓.←.→分别控制蛇的移动，F3为加速,F4为减速\n");
	SetPos(40, 16);
	printf("加速将能得到更高的分数\n");
	SetPos(50, 25);
	system("pause");
	setlocale(LC_ALL, "");
	system("cls");

	//打印地图
	PrintWall();
	getchar();
}

